package com.ruoyi.redis;

import com.ruoyi.common.redis.message.MessagePublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redisMessage")
public class RedisMessage {
    @Autowired
    private MessagePublisher messagePublisher;

    public RedisMessage(MessagePublisher messagePublisher) {
        this.messagePublisher = messagePublisher;
    }

    @RequestMapping("/publish")
    public void doSomethingAndPublishMessage() {
        // 执行一些操作
        String message = "Hello, Redis message queue!";
        messagePublisher.publishMessage(message);
    }
}
